<!--
 * @Author: Hunter
 * @Date: 2022-02-28 10:41:21
 * @LastEditTime: 2022-05-01 17:24:31
 * @LastEditors: Hunter
 * @Description: 
 * @FilePath: \book_mark\src\components\view-box\index.vue
 * 可以输入预定的版权声明、个性签名、空行等
-->
<template>
  <div class="view-box">
    <div class="view-content">
      <ul>
        <li>
          <Search :setKeyword="setKeyword"></Search>
        </li>
        <li>
          <BookmarkItem class="bookmark-item" :info="info"></BookmarkItem>
        </li>
      </ul>
    </div>
    <el-button class="reset" type="danger" size="large" @click="clearHandler"
      >重新导入书签</el-button
    >
  </div>
</template>

<script lang="ts">
import { getGlobal, StorageInterface } from "@/utils";
import Search from "@/components/search/index.vue";
import BookmarkItem from "@/components/bookmark-item/index.vue";
let storage: StorageInterface;
export default {
  data() {
    storage = getGlobal("storage");
    return {};
  },
  props: ["info", "setKeyword"],
  methods: {
    clearHandler() {
      storage.clearStorage("bookmarks");
      storage.setStorage("hadInfo", true);
      location.reload();
    },
  },
  components: {
    Search,
    BookmarkItem,
  },
};
</script>

<style scoped>
.view-box {
  width: 100%;
  display: flex;
}
.view-box > .reset {
  margin: 20px;
}
.view-content {
  box-sizing: border-box;
  padding: 50px;
  width: 100%;
  height: 100vh;
}
.view-content > ul {
  list-style: none;
}
.bookmark-item {
  margin-top: 20px;
}
</style>